import Vue from 'vue'
import pdfViewerHtml from './main.vue'

const PdfViewerConstructor = Vue.extend(pdfViewerHtml)

const pdfViewer = {
  install (Vue) {
    let $vm = new PdfViewerConstructor({
      el: document.createElement('div')
    })
    document.body.appendChild($vm.$el)
    let titleD = 'pdf预览'
    Vue.prototype.$pdfViewer = ({ url = '', title = titleD, isPrint = false } = {}) => {
      $vm.dialogPdfVisible = true
      $vm.title = title
      $vm.previewUrl = url
      $vm.isPrint = isPrint
    }
  }
}

Vue.use(pdfViewer)
